#include <wx/frame.h>
#include <wx/sizer.h>
#include <wx/filepicker.h>
#include <wx/listctrl.h>
#include <wx/panel.h>
#include <wx/button.h>
#include <wx/stattext.h>
#include <wx/msgdlg.h>
#include <wx/spinctrl.h>
#include <wx/progdlg.h>
#include "ImageDisplay.h"
#include <fstream>
#include <cstring>

enum class FileType;
class MainFrame : public wxFrame
{
    public:
        MainFrame();
        virtual ~MainFrame();
    private:
        wxFilePickerCtrl* filePicker;
        wxListCtrl* imageList;
        wxListCtrl* HandleList;  //用于提取被识别的图像
        ImageDisplay* imageDisplay;
        wxSpinCtrl* spinThreshold;
        wxSpinCtrl* spinAreaX;
        wxSpinCtrl* spinAreaY;
        wxButton* btnExecute;
        wxButton* btnFilter;
        wxButton* btnExeImageList;

        void on_btnExeImageList_click(wxCommandEvent& event);
        void on_spinHandleArea_change(wxSpinEvent& event);
        void on_btnFilter_click(wxCommandEvent& event);
        void on_btnExecute_click(wxCommandEvent& event);
        void on_filePicker_change(wxFileDirPickerEvent& event);
        void on_imageList_select(wxListEvent& event);
        std::fstream targetFile;
        FileType fileType;
        void OpenCCSFile(std::string path);
        void OpenBMPFile(std::string path);
        void selectImage(long index);
        void GetImageData(unsigned char** imageData,uint64_t* timesp);
        uint32_t imageWidth,imageHeight;
        const long headOffset=12;
        uint32_t imageNumber;
};

enum class MainFrameID
{
    filePicker,
    imageList,
    imageDisplay,
    spinThreshold,
    btnExecute,
    btnFilter,
    spinAreaX,
    spinAreaY,
    btnExeImageList,
    HandleList
};

enum class FileType
{
    ccs,
    bmp
};